# Maintainer: Alexander Epaneshnikov <alex19ep@archlinux.org>
# Contributor: ny-a <nyaarch64 at gmail dot com>
# Contributor: Cristian Delgado <cristdelc at gmail dot com>
# Contributor: Andrew Sun <adsun701 at gmail dot com>
# Contributor: Dmitrij D. Czarkoff <czarkoff at gmail dot com>

pkgname=libre
pkgver=3.5.1
pkgrel=1
pkgdesc="Portable library for real-time communications"
arch=('loong64' 'x86_64')
url="https://github.com/baresip/re"
license=('BSD')
depends=('openssl' 'zlib')
makedepends=('cmake')
replaces=('re' 'librem')
conflicts=('re' 'librem')
provides=(libre.so)
source=("${pkgname}-${pkgver}.tar.gz"::"https://github.com/baresip/re/archive/v${pkgver}.tar.gz")
sha256sums=('5cf31f95cd3d7df14c8f27a38b94a328b4d67c300686b49b6fae9cc0552f86e8')

build() {
  cd re-${pkgver}
  cmake -B build -DCMAKE_BUILD_TYPE='None' -DCMAKE_INSTALL_PREFIX='/usr' -Wno-dev
  cmake --build build
}

check() {
  cd re-${pkgver}
  cmake --build build --parallel -t retest
	build/test/retest -rv
}

package() {
  cd re-${pkgver}
  DESTDIR="$pkgdir" cmake --install build
  install -vDm644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}
